﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace ProyectoHCI
{
    public partial class pregunta2 : usuario
    {
        alumnoInicial alum;
        Timer time;
        public pregunta2()
        {
            InitializeComponent();
        }
        public pregunta2(Login l, alumnoInicial v)
        {
            login = l;
            alum = v;
            InitializeComponent();
            arrancarTimer();
        }
        private void arrancarTimer()
        {
            tiempo.Show();
            //timer
            time = new Timer();
            time.Interval = 250;
            time.Tick += new EventHandler(IncreaseProgressBar);
            time.Start();

        }

        private void volver_Click(object sender, EventArgs e)
        {
            if (time != null)
            {
                time.Stop();
                time.Dispose();
            }
            alum.Show();
            this.Hide();
            this.Dispose();
        }
        private void IncreaseProgressBar(object sender, EventArgs e)
        {
            // Increment the value of the ProgressBar a value of one each time.
            tiempo.Increment(-1);
            // Determine if we have completed by comparing the value of the Value property to the Maximum value.
            if (tiempo.Value < (tiempo.Maximum) / 3)
                reloj.Show();
            if (tiempo.Value == tiempo.Minimum)
            {
                termino(0);
                // Stop the timer.
                time.Stop();
            }
        }
        private void termino(int est)
        {
            time.Stop();
            time.Dispose();
            this.Hide();
            singlePlayer SP = new singlePlayer(login, alum, this, est, pregunta.Text);
            SP.Show();
            this.Dispose();
        }

        private void rta1_Click(object sender, EventArgs e)
        {
            termino(0);
        }

        private void rta2_Click(object sender, EventArgs e)
        {
            termino(1);
        }

        private void rta3_Click(object sender, EventArgs e)
        {
            termino(0);
        }

        private void rta4_Click(object sender, EventArgs e)
        {
            termino(0);
        }

        

    }
}
